package myJs.user.soft.keggEnrich

import myJs.I18n
import myJs.Implicits._
import myJs.Utils._
import myJs.myPkg.LayerOptions
import myJs.myPkg.jquery._
import myJs.tool.Pojo._
import myJs.tool.Tool
import myJs.tool.Tool._
import myJs.user.soft.VideoCp
import myJs.user.soft.fileSelect._
import org.scalajs.dom._
import org.scalajs.dom.ext.Ajax
import org.scalajs.macrotaskexecutor.MacrotaskExecutor.Implicits._
import scalatags.Text.all._
import shared.Pojo.{SharedKeggEnrichData, VarInfoDataKind}
import upickle.default._

import scala.collection.immutable.SeqMap
import scala.scalajs.js
import scala.scalajs.js.Dynamic.{global => g}
import scala.scalajs.js.JSON
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}

/**
 * Created by yz on 2019/4/25
 */
@JSExportTopLevel("KeggEnrich")
object KeggEnrich {

  val speciesData = SeqMap(
    "Mammals" -> SeqMap("hsa" -> "Homo sapiens  [80]",
      "mmu" -> "Mus musculus [82]",
      "rno" -> "Rattus norvegicus (rat)  [81]", "bta" -> "Bos taurus (cow)  [81]"),
    "Birds" -> SeqMap("gga" -> "Gallus gallus (chicken)  [78]"),
    "Fish" -> SeqMap("dre" -> "Danio rerio (zebrafish)  [81]"),
    "Insects" -> SeqMap("dme" -> "Drosophila melanogaster (fruit fly)  [79]"),
    "Nematodes" -> SeqMap("cel" -> "Caenorhabditis elegans (nematode)  [78]"),
    "Fungi" -> SeqMap("sce" -> "Saccharomyces cerevisiae (yeast)  [65]"),
    "Plants" -> SeqMap("osa" -> "Oryza sativa japonica (Japanese rice)  [83]",
      "ath" -> "Arabidopsis thaliana (thale cress)  [87]"),
    "Parasites" -> SeqMap("smm" -> "Schistosoma mansoni  [69]",
      "pfa" -> "Plasmodium falciparum 3D7 (Malaria)  [47]",
      "tbr" -> "Trypanosoma brucei  [54]"),
    "Prokaryotes" -> SeqMap("eco" -> "Escherichia coli K-12 MG1655  [87]",
      "bsu" -> "Bacillus subtilis  [80]",
      "ppu" -> "Pseudomonas putida KT2440  [89]", "sau" -> "Staphylococcus aureus N315 (MRSA/VSSA)  [73]",
      "tma" -> "Thermotoga maritima  [57]", "syf" -> "Synechococcus elongatus PCC7942  [75]",
      "mlo" -> "Mesorhizobium loti  [86]")
  )

  @JSExport("init")
  def init = {
    I18n.initialize()
    VideoCp.Props(soft=KeggEnrichSoft).render.renderIntoDOM(document.querySelector("#videoRoot"))
    Cp.Props(missionName = Tool.getMissionName).render.renderIntoDOM(document.querySelector("#root"))
  }

}
